package main.chapter3.manager

class Manager : Driver, Writer {
    override fun writer() {
    }

    override fun driver() {
    }

}

//通过by的接口代理的语法，相当于注释的override
class SeniorManager(private val driver: Driver, private val writer: Writer) : Driver by driver, Writer by writer {
//    override fun driver() {
//        driver.driver()
//    }
//
//    override fun writer() {
//        writer.writer()
//    }
}

class CarDriver : Driver {
    override fun driver() {
        println("开车中")
    }
}

class PPTWriter : Writer {
    override fun writer() {
        println("做PPT")
    }

}

interface Driver {
    fun driver()
}

interface Writer {
    fun writer()
}

fun main(args: Array<String>) {
    val carDriver = CarDriver()
    val pptWriter = PPTWriter()
    val seniorManager = SeniorManager(carDriver, pptWriter);
    seniorManager.driver()
    seniorManager.writer()
}